How can I validate a password for length and character requirements in JavaScript